function goBack(){
	appControl.goHome();
}


var srchList_index;

function showTodayFlow(curDate,flag){
	
	$("#start_date").val(curDate);
	$("#end_date").val(curDate);
	
	if(flag=="1"){
		doSrch();
	}
	
}


//查询记录
function doSrch(){
	
	if($.trim($("#start_date").val())=="" || $.trim($("#end_date").val())=="" ) {
		layer.msg("请输入查询起始和截止时间");
		return;
	}
	
	if(strToDate($.trim($("#start_date").val()))>strToDate($.trim($("#end_date").val()))){
		layer.msg("开始时间不能大于结束时间");
		return;
	}
	//alert($("#end_date").val());
	var rs = appControl.doSrch($("#start_date").val(),$("#end_date").val(),"-1");
	if(rs=="-1" || rs=="-100"){
		layer.msg("查询失败");
	}
}



function showSrchRs(rs){
	//alert(rs);
	
	
	$("#resultList").html("");
	$("#total_cs").html("");
	$("#total_je").html("");
	
	if(rs=="-1" || rs=="-100"){
		layer.msg("查询失败");
		return;
	}

	var jsonData = JSON.parse(rs);
	if(jsonData.is_success=="0"){
		layer.msg("查询失败");
	}else{
		var flows = jsonData.flows;
		if(flows==undefined){
			layer.msg("查询日期内无消费记录");
			return;
		}
		for(var i=0;i<flows.length;i++){
			var cardno = flows[i].CARDNO;
			var jytime = flows[i].JYSJ;
			var username = flows[i].USERNAME;
			var jyje = flows[i].JYJE;
			
			var usercode = flows[i].USERCODE;
			
			$("#resultList").append("<tr><td width='10%'>"+(i+1)+"</td><td width='30%'>"+jytime+"</td><td width='20%'>"+usercode+"</td><td width='20%'>"+username+" </td><td>"+jyje+"</td></tr>");
			
		}
		
		var total_cs = jsonData.total_count;
		var total_money = jsonData.total_money;
		
		$("#total_cs").html(total_cs);
		$("#total_je").html(total_money);
	}
	
	
	
	srchList_index = layer.open({
		  type: 1,
		  skin: 'layui-layer-rim', //加上边框
		  area: ['1050px', '550px'], //宽高
		  content:$("#srchDetail"),
		  title:"消费查询结果"
	});
}
